<?php
class Videos_content_Model extends ORM
{
	protected $table_name = 'videos_content';
	protected $primary_key = 'videos_content_id'; 
	protected $col_videos_id = 'videos_id';
	protected $col_language_id = 'languages_id';
	protected $sorting = array('videos_content_id' => 'desc');
	
	public function get($videos_id='',$language_id='')
	{
		$this->db->select('*');
		$this->db->from($this->table_name);		
		$this->db->orderby($this->primary_key,'desc');
		if($videos_id) $this->db->where($this->col_videos_id,$videos_id);
		if($language_id) $this->db->where($this->col_language_id,$language_id);
		$query = $this->db->get();
		return $query->result_array(false);
		
	}
	
	public function get_videos()
	{
		$this->db->select('*');
		$this->db->from('videos');
		$this->db->join('videos_content','videos.videos_id','videos_content.videos_id');
		$this->db->where('videos_status',1);
		$this->db->orderby('videos_sort_order','desc');	
		$this->db->orderby($this->primary_key,'desc');	
		$query = $this->db->get();
		return $query->result_array(false);
	}
}